//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __USYSCALL_H__
#define __USYSCALL_H__

#include <systype.h>
#include <clsinfo.h>
#include <elasys.h>

#define SYSCALLAPI EXTERN_C

SYSCALLAPI ECode SysGetMemtraceArgs(wchar_t *pwchArgId, Int32 *pIndex,
                                        Address *pWatchAddr);

SYSCALLAPI ECode SysPrint(const wchar_t * pwszMsg);

SYSCALLAPI ECode SysGetVirtualCode(struct KBDStatus *pVirtulCode);

SYSCALLAPI ECode SysReboot();

SYSCALLAPI ECode SysBreak(uint_t uAddr);

SYSCALLAPI ECode SysRegister(
        IStub *pIStub, EMuid * pCLSID, EIID * pIID,
        oid_t *pOid, CIClassEntry ** ppClsInfo);

SYSCALLAPI ECode SysUnregister(oid_t oid);

SYSCALLAPI ECode SysRegisterCommon(
        const wchar_t * pszName,
        IStub * pIStub, EMuid * pCLSID, EIID * pIID,
        oid_t * pRet, CIClassEntry ** ppClsInfo);

SYSCALLAPI ECode SysResolveCommon(
        const wchar_t * pszName, oid_t * pRet,
        EMuid *pClsid, UInt32 *puIndex, CIClassEntry ** ppClsInfo,
        PContext *ppContext);

SYSCALLAPI ECode SysUnregisterCommon(const wchar_t * pszName);

SYSCALLAPI ECode SysInvoke(
        oid_t oid, bool_t async, void *pvInBuf,
        size_t uInBufSize, void *pvOutBuf, size_t uOutBufSize);

SYSCALLAPI ECode SysReply(ECode ec,
        void *pvOutBuf, size_t uOutBufSize);

SYSCALLAPI ECode SysRegisterClassInfo(CIClassInfo * pClassInfo);

SYSCALLAPI ECode SysGetClassInfo(EMuid *pClsid, CIClassEntry **ppClassInfo);

SYSCALLAPI ECode SysRegisterService(const wchar_t * pwszName, oid_t oid);

SYSCALLAPI ECode SysWaitService(
        const wchar_t * pwszName, Int32 msTimeout, WaitResult *pResult);

SYSCALLAPI ECode SysAttachServer(oid_t oid, PContext pContext);

SYSCALLAPI ECode SysDetachServer(oid_t oid, PContext pContext);

SYSCALLAPI ECode SysExitThread(ECode exitCode);

SYSCALLAPI ECode SysCreateEvent(PVoid *pEventHandle);

SYSCALLAPI ECode SysDestroyEvent(PVoid eventHandle);

SYSCALLAPI ECode SysNotifyEvent(PVoid eventHandle);

SYSCALLAPI ECode SysWaitEvent(PVoid eventHandle);

enum BreakPointType
{
    BreakPointType_Exec         = 0x01,
    BreakPointType_Write        = 0x02,
    BreakPointType_ReadWrite    = 0x03,
};

SYSCALLAPI ECode SysSetBreakPoint(
        UInt32 uNo, BreakPointType type, void *pvAddress, UInt32 uLength);

SYSCALLAPI ECode SysSleep(int ms, WaitResult *pResult);

SYSCALLAPI ECode SysQueryPerformanceCounter(Int64 *pPerformanceCount, Int64 *pFrequency);

SYSCALLAPI ECode SysGetThreadStackTop(UInt32 *pStackTop);

SYSCALLAPI ECode SysSendToKernel(UInt32 *buf, UInt32 type);

#endif //__USYSCALL_H__
